package results;

import java.util.Date;

import equations.MathFactsCategory;


/**
 * The results of a single session.
 * @author stewarte
 *
 */
public class Result {
	private int countIncorrect;
	private int totalQuestions;
	private String username;
	private MathFactsCategory mfc;
	private Date d;
	
	/**
	 * Stores the results of one session
	 * 
	 * @param countIncorrect
	 * @param totalQuestions
	 * @param username
	 * @param mfc
	 * @param d
	 */
	public Result(int countIncorrect, int totalQuestions, String username, MathFactsCategory mfc,Date d){
		this.countIncorrect=countIncorrect;
		this.totalQuestions=totalQuestions;
		this.username=username;
		this.mfc=mfc;
		this.d=d;
	}
	
	/**
	 * Gets the incorrect count
	 * @return
	 */
	public int getIncorrectCount(){
		return countIncorrect;
	}
	
	/**
	 * Get the total number of questions
	 * @return
	 */
	public int getTotalQuestions(){
		return totalQuestions;
	}
	
	/**
	 * Gets the category name
	 * @return
	 */
	public String getResultCategory(){
		return mfc.toString();
	}
	
	/**
	 * Get's the name of the user that this result is related too.
	 * @return
	 */
	public String getUserName(){
		return username;
	}
	
	/**
	 * Gets the completion date for the result
	 * @return
	 */
	public Date getCompletionDate(){
		return d;
	}
	
	/**
	 * Returns the correct count.
	 * @return
	 */
	public int getCountCorrect(){
		return totalQuestions-countIncorrect;
	}
	
	public String getResultSummary(){
		return ""+mfc.toString()+" "+(totalQuestions-countIncorrect)+" out of "+totalQuestions+" on "+d.toString();
	}
	
}
